{extend name="base/base" /}
{block name="title"}新闻分类管理{/block}
{block name="content"}

<section class="Hui-article-box">
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 新闻管理 <span
                class="c-gray en">&gt;</span> 新闻分类管理 <a class="btn btn-success radius r"
                                                      style="line-height:1.6em;margin-top:3px"
                                                      href="javascript:location.replace(location.href);" title="刷新"><i
                    class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="Hui-article">
        <article class="cl pd-20">
            <div class="cl pd-5 bg-1 bk-gray">
                <span class="l">  <a class="btn btn-primary radius" href="/admin/newscate/create">
                        <i class="Hui-iconfont">&#xe600;</i> 添加新闻分类</a> </span>

            </div>

            <div class="mt-10">
                <table class="table table-border table-bordered table-hover table-bg">
                    <thead>
                    <tr>
                        <th scope="col" colspan="6">新闻分类管理</th>
                    </tr>
                    <tr class="text-c">
                        <th width="40">ID</th>
                        <th width="200">新闻分类名</th>
                        <th width="70">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="datas" id="data"}
                    <tr  class="text-c">
                        <td>{$data.id}</td>
                        <td>{$data.title}</td>
                        <td class="text-c">
                            <a title="编辑" href="/admin/newscate/{$data.id}/edit"
                               style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i>
                            </a>
                            <a title="删除" href="javascript:;" onclick="deleteitem({$data.id});"
                               class="ml-5"
                               style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i>
                            </a>
                        </td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
            </div>
        </article>
    </div>

    <!--删除-->
    <script>
        function deleteitem(id) {
            if (!confirm('确认操作，此操作不可逆?')) {
                return;
            }
            $.ajax({
                    type: "DELETE", //提交方式
                    url: "/admin/newscate/" + id,//路径
                    dataType: 'Json',
                    success: function (res) {
                        if (res.status == 1) {
                            alert(res.msg);
                            location.reload()
                        } else {
                            alert(res.msg);
                        }
                    }
                }
            )
        }
    </script>
</section>
{/block}